﻿using Service.Domain.Entities;
using Service.Domain.Entities.User;
using Service.Domain.Interfaces.Factories;
using Service.Domain.Interfaces.Repositories;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Service.Domain.Factories.User
{
    public class UserFactory : IUserFactory
    {
        readonly IUserRepository userRepository;
        readonly IPermissionRepository permissionRepository;
        readonly IRoleRepository roleRepository;

        public UserFactory(IUserRepository userRepository, IPermissionRepository permissionRepository, IRoleRepository roleRepository) {
            this.userRepository = userRepository;
            this.permissionRepository = permissionRepository;
            this.roleRepository = roleRepository;
        }

        public Entities.User.User CreateRoot()
        {
            return this.CreateRoot(new UserInfo());
        }

        public Entities.User.User CreateRoot(UserInfo userInfo)
        {
            return new Entities.User.User(userRepository, permissionRepository, roleRepository, userInfo);
        }
    }
}
